package org.leaf.green.b2b

class Inventory {

    Warehouse warehouse
    Product product
    String unit
    BigDecimal quantity
    BigDecimal available
    BigDecimal amount
    Date dateCreated
    Date lastUpdated

    static constraints = {
        warehouse(nullable:false)
        product(nullable:false, unique : 'warehouse')
        unit(nullable:false, blank:false, maxSize : 4)
        quantity(nullable:false, scale:2)
        available(nullable:false, scale:2)
        amount(nullable:false, scale:2)
    }

    static mapping ={
        table 'B2B_INVENTORY'
    }
}
